import pygame
from pygame.sprite import Sprite


class Bullet(Sprite):
    def __init__(self, screen, _x, _y, speed_factor = 1):
        super().__init__()
        self.screen = screen
        self.img = pygame.image.load("rc/pic/ic_bullet.png")
        self.rect = self.img.get_rect()

        self.speed_factor = speed_factor
        self.cx = float(_x)
        self.cy = float(_y)

        self.rect.centerx = self.cx
        self.rect.centery = self.cy

    def moving_update(self):
        self.cy -= self.speed_factor
        self.rect.centery = self.cy
        self.screen.blit(self.img, self.rect)
